home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 4,401 to 4,500 / aol-file-protocol-4400-4401-to-4500.zip / AOLDLs / Newton Miscellany / NW2 Vea, an Intelligent Diagr / Vea.sit / Newton Package Installer.rsrc / TEXT_128.txt < prev    next >
Text File  |  1995-11-22  |  2KB  |  54 lines

  1.  begin
  2.       local i, ans;
  3.       local root := GetRoot();
  4.             ans := clone(self.origphrase);
  5.             for i := 0 to Length(self.input)-1 do
  6.                if  (isa(self.input[i], 'commute_action))    then
  7.                    ans := filterStrings(self.phrases[i], ans);
  8.  
  9.                if (Length(ans) = 0) then 
  10.             city := nil;
  11.                else 
  12.             city := gluestrings(ans);
  13.  
  14.                if city then
  15.                begin
  16.                        local results, result, theCity, theWC;
  17.                        theWC := root.worldclock;
  18.                        results := [];
  19.                        result := theWC:find(city, results, 'localFind, nil );
  20.  
  21.                        if result and length(result.items) <> 0 then
  22.                           begin
  23.                                theCity := result.items[0];  // just get one
  24.                                theWC:SetNewLocation(theCity.entry);
  25.                           end
  26.                        else
  27.                        begin
  28.                 local cities := userConfiguration.|Commuter.Sharpe|.cities;
  29.                 for i := 0 to Length(cities) do 
  30.                 begin
  31.                    if (StrEqual(city, cities[i].name)) then
  32.                    begin
  33.                       theCity := cities[i];
  34.                       break;
  35.                    end;
  36.                                end;
  37.                  if (theCity) then
  38.                  begin
  39.                           AddUndoAction( 'SetLocation, [userconfiguration.location] );
  40.                            userconfiguration.location := theCity;
  41.                            if theCity.country then
  42.                               userconfiguration.currentCountry := theCity.country;
  43.                            if theCity.areaCode then
  44.                                  userconfiguration.currentAreaCode := theCity.areaCode & $ ;        
  45.                   end;
  46.                     end;
  47.  
  48.              if (theCity) then
  49.                 root.assistant:close();
  50.              else
  51.                             root.assistant:Duh(nil);
  52.          end;
  53.   end,
  54.